package com.lj.queue.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lj.common_web.annotation.ResponseResultVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.lj.queue.service.DelayQueueMetaService;
import jakarta.annotation.Resource;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.PathVariable;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
import com.lj.queue.param.DelayQueueMetaPageParam;
import com.lj.queue.result.DelayQueueMetaPageResult;
import com.lj.queue.result.DelayQueueMetaInfoResult;
import com.lj.queue.param.DelayQueueMetaUpdateParam;
import com.lj.queue.param.DelayQueueMetaSaveParam;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * <p>
 * 延迟队列数据表 前端控制器
 * </p>
 *
 * @author lj
 * @since 2025-07-18 17:15:03
 */
@RestController
@RequestMapping("/queue/delay_queue_meta")
@ResponseResultVo
@Tag(name = "延迟队列数据表 管理")
public class DelayQueueMetaController {

    @Resource
    private DelayQueueMetaService delayQueueMetaService;

    @GetMapping("/page")
    @SaCheckPermission("queue:delay_queue_meta:list")
    @Operation(summary = "延迟队列数据表 分页查询")
    public IPage<DelayQueueMetaPageResult> page(@ParameterObject DelayQueueMetaPageParam param) {
        return delayQueueMetaService.page(param);
    }

    @GetMapping("/info/{id}")
    @SaCheckPermission("queue:delay_queue_meta:info")
    @Operation(summary = "延迟队列数据表 信息")
    public DelayQueueMetaInfoResult info(@PathVariable("id") @Parameter(name = "id", description = "延迟队列数据表 id") Long id) {
        if (id == null) {
            return null;
        }
        return delayQueueMetaService.info(id);
    }

    @PostMapping("/save")
    @SaCheckPermission("queue:delay_queue_meta:save")
    @Operation(summary = "延迟队列数据表 新增")
    public void save(@RequestBody @Validated DelayQueueMetaSaveParam param) {
        delayQueueMetaService.save(param);
    }

    @PostMapping("/update")
    @SaCheckPermission("queue:delay_queue_meta:update")
    @Operation(summary = "延迟队列数据表 更新")
    public void update(@RequestBody @Validated DelayQueueMetaUpdateParam param) {
        delayQueueMetaService.update(param);
    }

    @PostMapping("/delete")
    @SaCheckPermission("queue:delay_queue_meta:delete")
    @Operation(summary = "延迟队列数据表 删除")
    public void delete(@RequestBody List<Long> ids) {
        delayQueueMetaService.delete(ids);
    }

}

